package blackitheima1.BigDecimalTest;

import java.math.BigDecimal;

public class BigDecimalDivide1 {
    public static void main(String[] args) {
        //创建BigDecimal对象进行除运算
        BigDecimal b1=new BigDecimal("0.75");
        BigDecimal b2=new BigDecimal("0.53");
        //保留4位小数,进一法 ROUND_UP
        BigDecimal divide1 = b1.divide(b2, 4, BigDecimal.ROUND_UP);
        System.out.println(divide1);
        //保留3位小数,去尾法 ROUND_FLOOR
        BigDecimal divide2 = b1.divide(b2, 3, BigDecimal.ROUND_FLOOR);
        System.out.println(divide2);
        //保留6位小数,四舍五入  ROUND_HALF_UP
        BigDecimal divide3 = b1.divide(b2, 6, BigDecimal.ROUND_HALF_UP);
        System.out.println(divide3);

    }
}
